package com.jic.data.service.impl;

import com.jic.data.mapper.SalesDetailDataMapper;
import com.jic.data.mapper.SalesReginAmountMapper;
import com.jic.data.model.entity.SalesDetailData;
import com.jic.data.model.entity.SalesReginAmount;
import com.jic.data.model.vo.response.SalesDetailDataResponse;
import com.jic.data.service.SalesDetailDataService;
import com.jic.data.service.SalesReginAmountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 接口实现类
 *
 * @author : 建投数据科技(山东)有限公司
 * @version : v1.0.0
 * @email :
 * @since : 2020-03-09 10:12:20
 */
@Service
@Slf4j
public class SalesDetailDataServiceImpl implements SalesDetailDataService {

	@Resource
	private SalesDetailDataMapper mapper;

	/**
	 * 销售概览-销售明细数据
	 *
	 * @param request 不分页查询入参实体类
	 * @return 数据库查到的实体类列表
	 */
	@Override
	public List<SalesDetailDataResponse> listAllRecord(SalesDetailData request) {
		List<SalesDetailData> list = mapper.selectBySelective(request);

		List<SalesDetailDataResponse> responseList = list.stream().map(temp -> {
			SalesDetailDataResponse bo = new SalesDetailDataResponse();
			BeanUtils.copyProperties(temp, bo);
			return bo;
		}).filter(item -> item != null).collect(Collectors.toList());

		return responseList;
	}




}
